package com.hex.ds.hdtp.core.app.script.transfer.dto.request;

import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * @Package: com.hex.ds.hdtp.core.app.transfer.script.dto.request
 * @ClassName ScriptConvertTaskRequestDto
 * @Description: 脚本转换任务-request对象
 * @Author: wz.li
 * @Date 2023/2/12 10:31
 * @Version v2.0.2
 **/
@Data
@Accessors(chain = true)
public class ScriptConvertTaskRequestDto {

    private String pkId;

    private String taskName;

    private String convertType;

    private String scriptImportType;

    private String sourceConnCode;

    private String targetConnCode;

    private String sourceFilePath;

    private String convertFilePath;

    private String uploadFilePath;

    private String status;

    private String dbName;

    private Integer todoNum;

    private Integer successNum;

    private Integer failNum;

    private String verifyStatus;

    private Integer verifyTotalNum;

    private Integer verifySuccessNum;

    private List<String> proceduresList;

    private List<String> fileList;

    public String getPkId() {
        return "null".equalsIgnoreCase(pkId) ? null : pkId;
    }

    public Integer getTodoNum() {
        if ("FILE".equals(scriptImportType)) {
            return fileList.size();
        } else if ("DATABASE".equals(scriptImportType)) {
            return proceduresList.size();
        } else {
            return todoNum;
        }
    }
}
